package com.imooc.api.controller.article;

import com.imooc.grace.result.GraceJSONResult;
import com.imooc.pojo.bo.CommentReplyBO;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * 评论相关业务
 */
@RequestMapping("comment")
public interface CommentControllerApi {

    /**
     * 用户评论
     */
    @PostMapping("createComment")
    GraceJSONResult createArticle( @Valid @RequestBody  CommentReplyBO commentReplyBO, BindingResult result);

    /**
     * 用户评论数查询
     */
    @GetMapping("counts")
    GraceJSONResult commentCounts(@RequestParam String articleId);

    /**
     * 查询文章的所有评论列表
     */
    @GetMapping("list")
    GraceJSONResult list(@RequestParam String articleId, @RequestParam Integer page, @RequestParam Integer pageSize);

    /**
     * 查询我的评论管理列表
     */
    @PostMapping("mng")
    GraceJSONResult mng(@RequestParam String writerId, @RequestParam Integer page, @RequestParam Integer pageSize);

    /**
     * 作者删除评论
     */
    @PostMapping("/delete")
    GraceJSONResult delete(@RequestParam String writerId, @RequestParam String commentId);

}
